package com.daoxiang.service.impl;

import com.daoxiang.dao.DistrictMapper;
import com.daoxiang.pojo.District;
import com.daoxiang.service.DistrictService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import tk.mybatis.mapper.entity.Example;

import java.util.List;

@Service
public class DistrictServiceImpl implements DistrictService {

    @Autowired
    private DistrictMapper districtMapper;

    @Override
    public District queryDistrictByDisId(String district) {
        return null;
    }

    @Override
    public List<District> queryAllDistrict() {
        return this.districtMapper.selectAll();
    }

    @Override
    public List<District> queryDistrictByCityId(String cityId) {
        Example example = new Example(District.class);
        Example.Criteria criteria = example.createCriteria();
        criteria.andEqualTo("cityId", cityId);
        return this.districtMapper.selectByExample(example);
    }
}
